package com.example.lotterysystem.common.exception;

import com.example.lotterysystem.common.errorcode.ErrorCode;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * @auther falls_vc
 * description:
 * @date 2025/5/7  20:35
 */
// 如果没有@EqualsAndHashCode(callSuper = true)  @Data 生成的equals和hashCode方法会与父类无关
@Data
@EqualsAndHashCode(callSuper = true)
public class ControllerException extends RuntimeException{
    /**
     * 异常码
     */
    private Integer code;
    /**
     * 异常信息
     */
    private String message;

    public ControllerException(){

    }
    public ControllerException(Integer code,String message){
        this.code=code;
        this.message=message;
    }
    public ControllerException(ErrorCode errorCode){
        this.code=errorCode.getCode();
        this.message=errorCode.getMsg();
    }
}
